//
//  LoginVC.m
//  PersonalOC
//
//  Created by 韩琴 on 2018/8/21.
//  Copyright © 2018年 韩琴. All rights reserved.
//

#import "LoginVC.h"

@interface LoginVC ()

@end

@implementation LoginVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"登陆";
}
- (IBAction)login:(id)sender {
    NSDictionary* userInfoDic = [[NSDictionary alloc] initWithObjectsAndKeys:@"88",@"id",@"默认昵称",@"nickName",@"avatar4",@"headPicUrl" ,nil];
    [UserShare dataWithModel:userInfoDic];
    [MyTools changeRootVc:[[BaseTabBarController alloc] init] and:false];
}
- (IBAction)QQLogin:(id)sender {
    [MyTools UMLogin:UMSocialPlatformType_QQ withOpenIDBlock:^(UMSocialUserInfoResponse *value) {
        DLog(@"%@",value);
        UMSocialUserInfoResponse *resp = value;
        
        NSString *wechatOpenid= resp.openid;
        
        NSString *nickName    = resp.name;
        
        NSString *headImagUrl    = resp.iconurl;
        
        NSDictionary* userInfoDic = [[NSDictionary alloc] initWithObjectsAndKeys:wechatOpenid,@"id",nickName,@"nickName",headImagUrl,@"headPicUrl" ,nil];
        
        [UserShare dataWithModel:userInfoDic];
        [MyTools changeRootVc:[[BaseTabBarController alloc] init] and:false];
    }];
}
- (IBAction)wechatLogin:(id)sender {
    [MyTools UMLogin:UMSocialPlatformType_WechatSession withOpenIDBlock:^(UMSocialUserInfoResponse *value) {
        DLog(@"%@",value);
        UMSocialUserInfoResponse *resp = value;
        
        NSString *wechatOpenid= resp.openid;
        
        NSString *nickName    = resp.name;
        
        NSString *headImagUrl    = resp.iconurl;
        
        NSDictionary* userInfoDic = [[NSDictionary alloc] initWithObjectsAndKeys:wechatOpenid,@"id",nickName,@"nickName",headImagUrl,@"headPicUrl" ,nil];
        
        [UserShare dataWithModel:userInfoDic];
        [MyTools changeRootVc:[[BaseTabBarController alloc] init] and:false];
    }];
}
- (IBAction)sinaLogin:(id)sender {
    [MyTools UMLogin:UMSocialPlatformType_Sina withOpenIDBlock:^(UMSocialUserInfoResponse *value) {
        DLog(@"%@",value);
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
